<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: NetworkStackTrafficGen Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00156.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">NetworkStackTrafficGen Class Reference<div class="ingroups"><a class="el" href="a00529.html">IEEE 802.15.4 Narrow band example - Classes from the ieee802154Narrow example</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="NetworkStackTrafficGen" --><!-- doxytag: inherits="BaseLayer" -->
<p>A module to generate traffic for the NIC, used for testing purposes.  
 <a href="a00156.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00241_source.html">NetworkStackTrafficGen.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for NetworkStackTrafficGen:</div>
<div class="dyncontent">
<div class="center"><img src="a00898.png" border="0" usemap="#NetworkStackTrafficGen_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for NetworkStackTrafficGen:</div>
<div class="dyncontent">
<div class="center"><img src="a00899.png" border="0" usemap="#NetworkStackTrafficGen_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00900.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><b>TrafficGenMessageKinds</b> { <b>TRAFFIC_TIMER</b> =  1, 
<b>BROADCAST_MESSAGE</b>, 
<b>TARGET_MESSAGE</b>
 }</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a481aa8f5da7d2ccffd94b157d429f81f"></a><!-- doxytag: member="NetworkStackTrafficGen::netwpkt_t" ref="a481aa8f5da7d2ccffd94b157d429f81f" args="" -->
typedef NetwPkt&#160;</td><td class="memItemRight" valign="bottom"><b>netwpkt_t</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6155db2897149e3c2d676c214070c5f4"></a><!-- doxytag: member="NetworkStackTrafficGen::netwpkt_ptr_t" ref="a6155db2897149e3c2d676c214070c5f4" args="" -->
typedef netwpkt_t *&#160;</td><td class="memItemRight" valign="bottom"><b>netwpkt_ptr_t</b></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#a4ad89047bebb99eaad2fd239cbc9e601">initialize</a> (int stage)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialization of the module and some variables.  <a href="#a4ad89047bebb99eaad2fd239cbc9e601"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a90fe5f22fbfc1034211df98c5aa21082"></a><!-- doxytag: member="NetworkStackTrafficGen::finish" ref="a90fe5f22fbfc1034211df98c5aa21082" args="()" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#a90fe5f22fbfc1034211df98c5aa21082">finish</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when the simulation has finished. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a97ba33f74bab38ce8045370fac87ab94"></a><!-- doxytag: member="NetworkStackTrafficGen::handleSelfMsg" ref="a97ba33f74bab38ce8045370fac87ab94" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#a97ba33f74bab38ce8045370fac87ab94">handleSelfMsg</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle self messages such as timer... <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a356ac886997e349785bdea455d87a920"></a><!-- doxytag: member="NetworkStackTrafficGen::handleLowerMsg" ref="a356ac886997e349785bdea455d87a920" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#a356ac886997e349785bdea455d87a920">handleLowerMsg</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from lower layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa7bae7e5b9e0df082742eef9580692b5"></a><!-- doxytag: member="NetworkStackTrafficGen::handleLowerControl" ref="aa7bae7e5b9e0df082742eef9580692b5" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#aa7bae7e5b9e0df082742eef9580692b5">handleLowerControl</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle control messages from lower layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa27138585461e46f30446c79fd273cd5"></a><!-- doxytag: member="NetworkStackTrafficGen::handleUpperMsg" ref="aa27138585461e46f30446c79fd273cd5" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#aa27138585461e46f30446c79fd273cd5">handleUpperMsg</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from upper layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a2b6aa131cdf2f822fb80b39d6a420f"></a><!-- doxytag: member="NetworkStackTrafficGen::handleUpperControl" ref="a2a2b6aa131cdf2f822fb80b39d6a420f" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#a2a2b6aa131cdf2f822fb80b39d6a420f">handleUpperControl</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle control messages from upper layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adc1d59fcef6f3bc66765feb3c642a1bf"></a><!-- doxytag: member="NetworkStackTrafficGen::sendBroadcast" ref="adc1d59fcef6f3bc66765feb3c642a1bf" args="()" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#adc1d59fcef6f3bc66765feb3c642a1bf">sendBroadcast</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a broadcast message to lower layer. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2d848488d29fe904d9ad7a60be91ef6e"></a><!-- doxytag: member="NetworkStackTrafficGen::packetLength" ref="a2d848488d29fe904d9ad7a60be91ef6e" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>packetLength</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a884092af7b24be0c92e56778dd82be92"></a><!-- doxytag: member="NetworkStackTrafficGen::packetTime" ref="a884092af7b24be0c92e56778dd82be92" args="" -->
simtime_t&#160;</td><td class="memItemRight" valign="bottom"><b>packetTime</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac802504365d5fadc96645c138b215e4e"></a><!-- doxytag: member="NetworkStackTrafficGen::pppt" ref="ac802504365d5fadc96645c138b215e4e" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><b>pppt</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a79fd1c7e19a3d441e5aef561d593a7ac"></a><!-- doxytag: member="NetworkStackTrafficGen::burstSize" ref="a79fd1c7e19a3d441e5aef561d593a7ac" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>burstSize</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3bfb93461641c3485510051650586128"></a><!-- doxytag: member="NetworkStackTrafficGen::remainingBurst" ref="a3bfb93461641c3485510051650586128" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>remainingBurst</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abbce5c7ea80eb9bd6b6e7002aa58c6af"></a><!-- doxytag: member="NetworkStackTrafficGen::destination" ref="abbce5c7ea80eb9bd6b6e7002aa58c6af" args="" -->
<a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a>&#160;</td><td class="memItemRight" valign="bottom"><b>destination</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aede442614cce7fc393ad88ca2feb3de2"></a><!-- doxytag: member="NetworkStackTrafficGen::nbPacketDropped" ref="aede442614cce7fc393ad88ca2feb3de2" args="" -->
long&#160;</td><td class="memItemRight" valign="bottom"><b>nbPacketDropped</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af883aa2c26bdc3d69a6ccbf13494bf90"></a><!-- doxytag: member="NetworkStackTrafficGen::arp" ref="af883aa2c26bdc3d69a6ccbf13494bf90" args="" -->
<a class="el" href="a00015.html">ArpInterface</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>arp</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7aecae02b9301daab90ea0e113a1357f"></a><!-- doxytag: member="NetworkStackTrafficGen::myNetwAddr" ref="a7aecae02b9301daab90ea0e113a1357f" args="" -->
<a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a>&#160;</td><td class="memItemRight" valign="bottom"><b>myNetwAddr</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9e84ee1b316106ff7d64e5aefb3d38da"></a><!-- doxytag: member="NetworkStackTrafficGen::delayTimer" ref="a9e84ee1b316106ff7d64e5aefb3d38da" args="" -->
cMessage *&#160;</td><td class="memItemRight" valign="bottom"><b>delayTimer</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae00f01ae82d87db04d710ce6467c402b"></a><!-- doxytag: member="NetworkStackTrafficGen::world" ref="ae00f01ae82d87db04d710ce6467c402b" args="" -->
<a class="el" href="a00030.html">BaseWorldUtility</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>world</b></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a37ba2e065c40183dd82dda83fe20879e"></a><!-- doxytag: member="NetworkStackTrafficGen::NetworkStackTrafficGen" ref="a37ba2e065c40183dd82dda83fe20879e" args="(const NetworkStackTrafficGen &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#a37ba2e065c40183dd82dda83fe20879e">NetworkStackTrafficGen</a> (const <a class="el" href="a00156.html">NetworkStackTrafficGen</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a00cc017cce8e55146355be3bd275322e"></a><!-- doxytag: member="NetworkStackTrafficGen::operator=" ref="a00cc017cce8e55146355be3bd275322e" args="(const NetworkStackTrafficGen &amp;)" -->
<a class="el" href="a00156.html">NetworkStackTrafficGen</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#a00cc017cce8e55146355be3bd275322e">operator=</a> (const <a class="el" href="a00156.html">NetworkStackTrafficGen</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A module to generate traffic for the NIC, used for testing purposes. </p>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a4ad89047bebb99eaad2fd239cbc9e601"></a><!-- doxytag: member="NetworkStackTrafficGen::initialize" ref="a4ad89047bebb99eaad2fd239cbc9e601" args="(int stage)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void NetworkStackTrafficGen::initialize </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stage</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialization of the module and some variables. </p>
<p>First we have to initialize the module from which we derived ours, in this case <a class="el" href="a00027.html" title="Base class for all simple modules of a host.">BaseModule</a>. This module takes care of the gate initialization. </p>

<p>Reimplemented from <a class="el" href="a00025.html#a70f5ea30a9980d57b8384faed29ec3eb">BaseLayer</a>.</p>

<p>References <a class="el" href="a00025.html#a665bf8ad06b2c4b5419669869e68ef00">BaseLayer::catPacketSignal</a>, <a class="el" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2">BaseModule::findHost()</a>, <a class="el" href="a00201.html#aa01f017b96087bc252445206777e0080">simsignalwrap_t::initialize()</a>, and <a class="el" href="a00004.html#a3f4172beef51056ebc815246b6c9d651">AddressingInterface::myNetwAddr()</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="code" href="a00156.html#a4ad89047bebb99eaad2fd239cbc9e601" title="Initialization of the module and some variables.">BaseLayer::initialize</a>(stage);

  <span class="keywordflow">if</span>(stage == 0) {
    world = <a class="code" href="a00093.html" title="Provides method templates to find omnet modules.">FindModule&lt;BaseWorldUtility*&gt;::findGlobalModule</a>();
    delayTimer   = <span class="keyword">new</span> cMessage(<span class="stringliteral">&quot;delay-timer&quot;</span>, TRAFFIC_TIMER);

    arp          = <a class="code" href="a00093.html" title="Provides method templates to find omnet modules.">FindModule&lt;ArpInterface*&gt;::findSubModule</a>(<a class="code" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2" title="Function to get a pointer to the host module.">findHost</a>());

    packetLength = par(<span class="stringliteral">&quot;packetLength&quot;</span>);
    packetTime = par(<span class="stringliteral">&quot;packetTime&quot;</span>);
    pppt = par(<span class="stringliteral">&quot;packetsPerPacketTime&quot;</span>);
    burstSize = par(<span class="stringliteral">&quot;burstSize&quot;</span>);
    destination = <a class="code" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4" title="Type definition for a L3 (Network) address.">LAddress::L3Type</a>(par(<span class="stringliteral">&quot;destination&quot;</span>).longValue());

    nbPacketDropped = 0;
    <a class="code" href="a00025.html#a665bf8ad06b2c4b5419669869e68ef00" title="SignalID for packets.">BaseMacLayer::catPacketSignal</a>.<a class="code" href="a00201.html#aa01f017b96087bc252445206777e0080">initialize</a>();
  }
  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (stage == 1) {
    <a class="code" href="a00004.html" title="Interface for modules which assign L2 and L3 addresses for modules.">AddressingInterface</a>* addrScheme = <a class="code" href="a00093.html" title="Provides method templates to find omnet modules.">FindModule&lt;AddressingInterface*&gt;</a>
<a class="code" href="a00093.html" title="Provides method templates to find omnet modules.">                                                    ::findSubModule</a>(<a class="code" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2" title="Function to get a pointer to the host module.">findHost</a>());
    <span class="keywordflow">if</span>(addrScheme) {
      myNetwAddr = addrScheme-&gt;<a class="code" href="a00004.html#a3f4172beef51056ebc815246b6c9d651" title="Returns the L3 address for the passed net.">myNetwAddr</a>(<span class="keyword">this</span>);
    } <span class="keywordflow">else</span> {
      myNetwAddr = <a class="code" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4" title="Type definition for a L3 (Network) address.">LAddress::L3Type</a>( getId() );
    }
    <span class="keywordflow">if</span>(burstSize &gt; 0) {
      remainingBurst = burstSize;
      scheduleAt(dblrand() * packetTime * burstSize / pppt, delayTimer);
    }
  } <span class="keywordflow">else</span> {

  }
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/examples/ieee802154Narrow/<a class="el" href="a00241_source.html">NetworkStackTrafficGen.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/examples/ieee802154Narrow/NetworkStackTrafficGen.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00156.html">NetworkStackTrafficGen</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:32 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
